<h1>创建博客</h1>

<div class="row">
  <div class="col-sm-5">
    <%= form_for @blog, url: blogs_path, method: :post do |f| %>
      <div class="form-group">
        <ul class="list-unstyled">
          <% @blog.errors.messages.values.flatten.each do |error| %>
          <li><i class="fa"><% error %></i></li>
          <% end %>
        </ul>
      </div>

      <div class="form-group"><%= f.text_field :title, class: 'form-control', placeholder: '标题' %></div>

      <div class="form-group"><%= f.text_area :content, class: 'form-control', placeholder: '内容' %></div>

      <div class="form-group">
        <% [[true, '显示'], [false, '不显示']].each do |public| %>
          <input type="radio" name="blog[is_public]" value="<%= public.first %>" class="form-check-input">
          <%= public.last %>
        <% end %>
      </div>

      <div class="form-group">
        <input type="text" name="blog[tags_string]" class="form-control" placeholder="标签名逗号分割" />
      </div>
      <%= f.submit "保存", class: 'btn btn-primary' %>
    <% end %>
  </div>
</div>
